<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>修改密码 - 仓储管理系统</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
  <link href="light/css/bootstrap.min.css" rel="stylesheet" th:href="@{/light/css/bootstrap.min.css}">
  <link href="light/css/materialdesignicons.min.css" rel="stylesheet" th:href="@{/light/css/materialdesignicons.min.css}">
  <link href="light/css/style.min.css" rel="stylesheet" th:href="@{/light/css/style.min.css}">
</head>
  
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    <div th:replace="commons/bar::sidebar"></div>
    <!--End 左侧导航-->

    <!--头部信息-->
    <header class="lyear-layout-header">

      <nav class="navbar navbar-default">
        <div class="topbar">
          <div class="topbar-left">
            <div class="lyear-aside-toggler">
              <span class="lyear-toggler-bar"></span>
              <span class="lyear-toggler-bar"></span>
              <span class="lyear-toggler-bar"></span>
            </div>
            <span class="navbar-page-title">修改密码</span>
          </div>
          <div th:replace="commons/bar::header"></div>
        </div>
      </nav>
    </header>
    <!--End 头部信息-->
    
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                <span class="msg" style="color: red" th:text="${loginerror}" th:if="${not #strings.isEmpty(loginerror)}"></span>
                <form method="post" action="#!" th:action="@{/updPwd}" class="site-form" onSubmit="return beforeSubmit(this);">
                  <input type="hidden" name="_method" value="PUT"/>
                  <div class="form-group">
                    <label for="old-password">旧密码</label>
                    <input type="password" class="form-control" name="oldpwd" id="old-password" placeholder="输入账号的原登录密码">
                  </div>
                  <div class="form-group">
                    <label for="new-password">新密码</label>
                    <input type="password" class="form-control" name="newpwd" id="new-password" placeholder="请输入新的密码">
                  </div>
                  <div class="form-group">
                    <label for="confirm-password">确认新密码</label>
                    <input type="password" class="form-control" name="confirmpwd" id="confirm-password" placeholder="请再次输入新密码">
                  </div>
                  <button type="submit" class="btn btn-primary">修改密码</button>
                </form>
       
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="light/js/jquery.min.js" th:src="@{/light/js/jquery.min.js}"></script>
<script type="text/javascript" src="light/js/bootstrap.min.js" th:src="@{/light/js/bootstrap.min.js}"></script>
<script type="text/javascript" src="light/js/perfect-scrollbar.min.js" th:src="@{/light/js/perfect-scrollbar.min.js}"></script>
<script type="text/javascript" src="light/js/main.min.js" th:src="@{/light/js/main.min.js}"></script>
<!--表单校验-->
<script type="text/javascript">
    function beforeSubmit(form){
        if(form.oldpwd.value==''){
            alert('原密码不能为空！');
            form.oldpwd.focus();
            return false;
        }
        if(form.newpwd.value==''){
            alert('新密码不能为空！');
            form.newpwd.focus();
            return false;
        }
        if(form.confirmpwd.value==''){
            alert('确认密码不能为空！');
            form.confirmpwd.focus();
            return false;
        }
        if(form.newpwd.value!=form.confirmpwd.value){
            alert('两次输入的密码不一致');
            form.newpwd.focus();
            form.confirmpwd.focus();
            return false;
        }
        return true;
    }
</script>
</body>
</html>